<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // function h(List1, List2) {
        //     const arr = []
        //     for (let i = 0; i < list1.length; i++) {
        //         arr.push(list1[i])
        //     }
        //     for (let j = 0; j < list2.length; j++) {
        //         arr.push(list2[j])
        //     }
        //     arr.sort()
        //     return arr
        // }
        // console.log(h([1, 2], [1, 3]));
        function ff() {
            console.log(this, '---this');
        }
        ff() // this是全局

        var handler = {
            id: '123456',

            init: function () {
                console.log(this);
                document.addEventListener('click',
                    event => this.doSomething(event.type), false);
            },

            doSomething: function (type) {
                console.log('Handling ' + type + ' for ' + this.id);
            }
        };
        var handler = {
            id: '123456',

            init: function () {
                console.log(this);
                document.addEventListener('click',
                    event => this.doSomething(event.type), false);
            },

            doSomething: function (type) {
                console.log('Handling ' + type + ' for ' + this.id);
            }
        };
        handler.init()

        function foo() {
            console.log(this, '---this');
            return () => {
                return () => {
                    return () => {
                        console.log('id:', this.id);
                    };
                };
            };
        }

        var f = foo.call({ id: 1 });


    </script>
</body>

</html>